<?php
/**
 * My new Zend Framework project
 * 
 * @author  
 * @version $Id: $
 */

set_include_path('.' . PATH_SEPARATOR . '../library' . PATH_SEPARATOR . './application/models' . PATH_SEPARATOR . get_include_path() . PATH_SEPARATOR . "C:/Program Files/Zend/Zend Studio for Eclipse - 6.0.1/plugins/org.zend.php.framework.resource_6.0.1.v20080601/resources/ZendFramework_1.5/");
require_once 'Zend/Controller/Front.php';
require_once 'Zend/Layout.php';

// Setup database
$config = new Zend_Config_Ini('../config.ini', 'database');
$db = Zend_Db::factory($config);
Zend_Db_Table::setDefaultAdapter($db);

// Setup controller
$controller = Zend_Controller_Front::getInstance();
$controller->setControllerDirectory('../application/manage/controllers');
$controller->throwExceptions(false); // should be turned on in development time 

// bootstrap layouts
Zend_Layout::startMvc(array(
    'layoutPath' => '../application/manage/layouts',
    'layout' => 'main'
	));

// run!
$controller->dispatch();

function __autoload ($class_name)
{
    $class_file = str_replace('_', '/', $class_name) . '.php';
    require_once "$class_file";
}